package cn.edu.nchu.fragmentdemo.fragments;

import android.content.res.ColorStateList;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;

import com.google.android.material.textfield.TextInputEditText;
import com.google.android.material.textfield.TextInputLayout;

import java.util.ArrayList;

import cn.edu.nchu.fragmentdemo.R;
import cn.edu.nchu.fragmentdemo.adapter.RouteTaskAdapter;
import cn.edu.nchu.fragmentdemo.db.dao.RouteTaskDao;
import cn.edu.nchu.fragmentdemo.db.server.RouteTaskDataServer;
import lombok.SneakyThrows;

/**
 * @className: UavRouteTaskNameEditFragment
 * @description: TODO 类描述
 * @author: Kuangkeli
 * @date: 2023/10/09 11:03
 **/
public class UavRouteTaskNameEditFragment extends Fragment {

    private TextInputEditText textInputEditText;
    private TextInputLayout textInputLayout;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

        View rootView = inflater.inflate(R.layout.fragment_uav_route_name_edit, container, false);
        textInputEditText = rootView.findViewById(R.id.textField);
        textInputLayout = rootView.findViewById(R.id.textFieldLayout);
        Bundle bundle = getArguments();
        if (bundle != null) {
            String routeTaskName = bundle.getString("RouteTaskName");
            textInputEditText.setText(routeTaskName);
        }
        return rootView;
    }

    @SneakyThrows
    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        textInputLayout.setBoxStrokeColor(getResources().getColor(R.color.font_color));
        textInputLayout.setHintTextColor(ColorStateList.valueOf(ContextCompat.getColor(getContext(), R.color.blue_100)));
        textInputLayout.setCounterTextColor(ColorStateList.valueOf(ContextCompat.getColor(getContext(), R.color.font_color)));
    }
}
